Update AI Chat History Thread Name
API Documentation
Projects -> Api Key
Connections
Data -> Catalogs
Data -> Internal Tables
Data -> Queries
Data -> Semantic Catalogs
Data -> Cache
Embedded Peaka Api
Supported Drivers
Data -> Metadata
- PUTUpdate Metadata
- PUTUpdate Relation From Metadata
- DELDelete Relation From Metadata
- PUTGenerate categorical values from the the column.
- POSTGenerate semantics for the table
- POSTAdd Relation To Metadata
- GETList of golden sqls for the project.
- POSTCreate golden sql for the project
- GETGet Project Metadata
- GETGet Project Catalog Metadata Relations
- GETGenerate sample ai questions for the project
- DELDelete golden sql from the project.
Update AI Chat History Thread Name
PUT
/
ai
/
{projectId}
/
agent
/
history
/
{threadId}
curl --request PUT \
--url https://partner.peaka.studio/api/v1/ai/{projectId}/agent/history/{threadId} \
--header 'Content-Type: application/json' \
--data '{
"name": "Top Portfolios"
}'
{
"history": [
{
"id": "def9ccc7-a791-42f9-b40f-47679cde3b12",
"aiThreadId": "2183372c-7b72-479a-9eec-dd29aafa255b",
"displayName": "What are the top 3 portfolios ranked by their total market value as of the most recent date recorded?",
"tasks": [
{
"step": [
{
"action": {
"log": "The first example is very similar to the current question. I will use the SQL query from that example and modify it to fit the current question, ensuring it retrieves the top 3 portfolios ranked by their total market value as of the most recent date recorded.\n\nAction: table-name-semantic-search-tool\nAction Input: portfolios, market value, date",
"tool": "table-name-semantic-search-tool",
"toolInput": "portfolios, market value, date"
},
"observation": "supabase.public.portfolios,supabase.public.holdings,supabase.public.currencies,supabase.public.assets,supabase.public.assetclasses,supabase.public.assettypes,supabase.public.exchanges,supabase.public.transactiontypes,supabase.public.transactions,supabase.realtime.schema_migrations"
}
],
"output": {
"data": [
[
{
"name": "portfolio_name",
"order": 0,
"value": "102296_9",
"dataType": "varchar"
},
{
"name": "total_market_value",
"order": 1,
"value": 1887237400,
"dataType": "real"
}
]
],
"text": "The top 3 portfolios ranked by their total market value as of the most recent date recorded are: Portfolio '102296_9' with a total market value of 1,887,237,400, Portfolio '103100_7' with a total market value of 6,269,447.5, and Portfolio '103271_3' with a total market value of 2,563,462.8.",
"query": "WITH LatestDate AS ( SELECT MAX(\"date\") AS \"latest_date\" FROM \"supabase\".\"public\".\"holdings\" ) SELECT h.\"portfolio_name\", SUM(h.\"ending_market_value\") AS \"total_market_value\" FROM \"supabase\".\"public\".\"holdings\" h JOIN LatestDate ld ON h.\"date\" = ld.\"latest_date\" GROUP BY h.\"portfolio_name\" ORDER BY \"total_market_value\" DESC LIMIT 5"
},
"message": "What are the top 3 portfolios ranked by their total market value as of the most recent date recorded?",
"modelParams": {
"modelName": "gpt-4o",
"temperature": 0
}
}
],
"source": "API_KEY"
}
]
}
Body
application/json
New AI Chat Thread Name
Represents a request to update AI chat history.
The new name for the AI chat thread.
Response
200 - application/json
Update AI Chat History Thread Name
Represents the response containing AI chat history.
The list of AI chat history records.
The unique identifier for the project.
The unique identifier for the AI thread.
The display name of the chat history.
The list of tasks in the chat history.
Represents the output of chat history, containing the query, response text, and structured data related to the query results.
The message associated with the task.
The model parameters used in the task.
The source of the chat history.
curl --request PUT \
--url https://partner.peaka.studio/api/v1/ai/{projectId}/agent/history/{threadId} \
--header 'Content-Type: application/json' \
--data '{
"name": "Top Portfolios"
}'
{
"history": [
{
"id": "def9ccc7-a791-42f9-b40f-47679cde3b12",
"aiThreadId": "2183372c-7b72-479a-9eec-dd29aafa255b",
"displayName": "What are the top 3 portfolios ranked by their total market value as of the most recent date recorded?",
"tasks": [
{
"step": [
{
"action": {
"log": "The first example is very similar to the current question. I will use the SQL query from that example and modify it to fit the current question, ensuring it retrieves the top 3 portfolios ranked by their total market value as of the most recent date recorded.\n\nAction: table-name-semantic-search-tool\nAction Input: portfolios, market value, date",
"tool": "table-name-semantic-search-tool",
"toolInput": "portfolios, market value, date"
},
"observation": "supabase.public.portfolios,supabase.public.holdings,supabase.public.currencies,supabase.public.assets,supabase.public.assetclasses,supabase.public.assettypes,supabase.public.exchanges,supabase.public.transactiontypes,supabase.public.transactions,supabase.realtime.schema_migrations"
}
],
"output": {
"data": [
[
{
"name": "portfolio_name",
"order": 0,
"value": "102296_9",
"dataType": "varchar"
},
{
"name": "total_market_value",
"order": 1,
"value": 1887237400,
"dataType": "real"
}
]
],
"text": "The top 3 portfolios ranked by their total market value as of the most recent date recorded are: Portfolio '102296_9' with a total market value of 1,887,237,400, Portfolio '103100_7' with a total market value of 6,269,447.5, and Portfolio '103271_3' with a total market value of 2,563,462.8.",
"query": "WITH LatestDate AS ( SELECT MAX(\"date\") AS \"latest_date\" FROM \"supabase\".\"public\".\"holdings\" ) SELECT h.\"portfolio_name\", SUM(h.\"ending_market_value\") AS \"total_market_value\" FROM \"supabase\".\"public\".\"holdings\" h JOIN LatestDate ld ON h.\"date\" = ld.\"latest_date\" GROUP BY h.\"portfolio_name\" ORDER BY \"total_market_value\" DESC LIMIT 5"
},
"message": "What are the top 3 portfolios ranked by their total market value as of the most recent date recorded?",
"modelParams": {
"modelName": "gpt-4o",
"temperature": 0
}
}
],
"source": "API_KEY"
}
]
}